home *** CD-ROM | disk | FTP | other *** search
- //*****************************************************************************
- // Demo1.prg
- // ⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒø
- // ≥ Simple (trivial) demo application created with OBJECT.lib ≥
- // ≥ Length of source code is (without notes) 45 lines, 1310 bytes ≥
- // ¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ
- // (c) 1991, JHK, JHK-Software, Piestany
- //
- // Author:
- // Jan Hercek
- // JHK-Software
- // N.Teslu 26
- // 92101 Piestany
- // Slovak republic
- // (in central Europe)
- //
- // (tel: +42/838/21782)
- //
- // Compile with Clipper.exe, switches: /N/M/W/A
- // Link command: RtLink FI Demo1 LIB Object
- // or: RtLink FI Demo1 PLL Object
- //*****************************************************************************
-
- #include "Set.ch"
- #include "InKey.ch"
- #include "Object.ch"
-
- static oD,oV,oM //objects: Database,View,Menu
-
- procedure Main(clr) //clr=color definition (please run this program with a parameter /?)
- ObjectInit(clr,"Demo1",2,1992) //init of library, parameters: colors, program_name,version,year
- object oD of Dbf init DInit() //open/create the database files, strukture is in DInit(); if a password is required, then user is prompted for it.
- object oV of View init VInit() //edit/view window, definition: indexes, filters, reports.
- object oM of Menu init MInit() //create menu system.
- oM:Process() //main program loop
- ObjectDone() //destroy the object system (close dabases, restore screen)
- return //return into DOS
-
- procedure DInit() //database structure definition
- oD:AddDbf("Employ") //new database (file) name
- oD:AddField("Name", "C",20) //field definition: FieldName,Type,Length,Dec
- oD:AddField("Birth","D") //...date...
- oD:AddField("Pay", "N",8,2) //...numeric...
- oD:AddField("Note", "M") //...memo...
- return
-
- procedure VInit() //view definition
- oV:Select("Employ") //primary (selected) database
- oV:AddField("First & last name","Name", "field->Name") //fields definition for wiew and report
- oV:AddField("Annual pay", "Pay", "field->Pay") //(read_name,browse_name,field_name_from_dbf)
- oV:AddField("Birth date", "Birth","field->Birth") //...
- oV:AddMemo( "Remarks", "Rem.", "field->Note") //...
- return
-
- procedure MInit() //menu structure definition
- oM:AddBar("~File") //new item into bar line
- oM:AddView("~Employees","Employees", oV) //submenu_view: menu_name, window_name, object
- oM:AddItem("Text ~file", {||FInfoShow()}) //simple menu item: menu_name, action
- oM:AddItem("E~xit Alt-X", {||oM:Done()}, K_ALT_X) //... with "hot_key"
- oM:AddBar("~Archiv")
- oM:AddItem("~Save on disk a:", {||oD:Save("a:")})
- oM:AddItem("~Restore from disk a:", {||oD:Load("a:")})
- oM:AddBar("~Problems?")
- oM:AddItem("~Reindex", {||oD:ReIndex()})
- oM:AddItem("~Pack", {||oD:Pack()})
- oM:AddItem("~Change password", {|i|oM:Password(i)})
- oM:AddCheck("~Wrap menu", {|i,v|Set(_SET_WRAP,v)})
- return
-
- //
- //All program is only linear describe of desired actions,
- //without any jumps, loops, ...
- //without any screen positionning commands,
- //with the minimal possibility to create any error.
- //
- //Remember:
- //this is a NET version, a program created by with OBJECT.lib has NET capability
- //
- //Excuse me, please, for my terrible english. Many thanks.
- //(Have you any job for me?)
- //
- //˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ it is REALLY end of program ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙
-